<?php 
function postDataUrlByCURL($data, $url = '', $return = true) {
   $ch = curl_init($url);
   curl_setopt($ch, CURLOPT_POST, true);
   curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
   curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
   if($return) {
      $result = curl_exec($ch);
      $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      return array('status' => $status, 'respone_text' => $result);
   }
}

function postDataUrlByForm($data, $url = '') {
        $str = "<form action='" . $url . "' method='post' name='frm'>";
        foreach ($data as $a => $b) {
            $str .= "<input type='hidden' name='".$a."' value='".$b."'>";
        }
        $str .= "</form>";
        $str .= '<script language="JavaScript">document.frm.submit();</script>';
        echo $str;
} 
function postDataUrlByCURL2($data, $url = '', $return = true){
   $url_parse = parse_url($url);
   $file = $_SERVER["DOCUMENT_ROOT"].'\home\cookie.txt';
   $ch = curl_init(); 
   curl_setopt ($ch, CURLOPT_URL, $url); 
   curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
   curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); 
   curl_setopt ($ch, CURLOPT_TIMEOUT, 60); 
   curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 0); 
   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); 
   curl_setopt ($ch, CURLOPT_COOKIESESSION, 1);
   curl_setopt ($ch, CURLOPT_COOKIEJAR, $url_parse["host"]);
   curl_setopt ($ch, CURLOPT_REFERER, "http://".$url_parse["host"]);
   curl_setopt ($ch, CURLOPT_COOKIEFILE, $file);
   curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); 
   curl_setopt ($ch, CURLOPT_POST, 1); 
   if($return) {
      $result = curl_exec($ch);
      $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      return array('status' => $status, 'respone_text' => $result);
   }  
}
?>